module.exports = async (ctx, next) => {
    ctx.set("Access-Control-Allow-Origin", ctx.request.headers.origin);
    ctx.set("Access-Control-Allow-Credentials", true);
    ctx.set("Access-Control-Allow-Headers", "Content-Type,Access-Token,x-requested-with,authorization");
    ctx.set("Access-Control-Allow-Methods", "POST,DELETE,PUT,PATCH,GET,OPTIONS");

    if (ctx.request.method === "OPTIONS") {
        ctx.body = {
            msg: "200拿好滚粗",
        };
    } else {
        await next();
    }
};
